<template>
    <basic-container>
        <div style="width:60%;margin-top: 10px;">
            <avue-form ref="form" v-model="obj" :option="option"  @submit="submit">
            </avue-form>
        </div>
    </basic-container>
</template>
<script>
    import {
        setOrder,
        getOrder
    } from "../../api/base/sysSet/orderSet";
    import { testSort } from '@/util/util';
    export default {
        data() {
            return {
                obj:{},
                option:{
                    emptyBtn:false,
                    labelWidth:'360',
                    labelPosition:'left',
                    column: [{
                        placeholder:'退货申请多长时间变为申请成功(以天为单位)',
                        label: "退货申请多长时间变为申请成功(以天为单位)",
                        prop: "auto_record_applyToCompleted",
                        tip:"退货已申请多长时间，自动变为申请成功(以天为单位)",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入退货申请多长时间变为申请成功",
                                trigger: "blur"
                            },
                            {
                                validator: testSort,
                                trigger: "blur"
                            }
                        ]
                    },{
                        placeholder:'退货已发货多长时间，卖家自动确认收货(以天为单位)',
                        label: "退货已发货多长时间，自动确认收货(以天为单位)",
                        prop: "auto_record_deliverToCompleted",
                        tip:"退货已发货多长时间，卖家自动确认收货(以天为单位)",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入退货已发货多长时间，自动确认收货",
                                trigger: "blur"
                            },
                            {
                                validator: testSort,
                                trigger: "blur"
                            }
                        ]
                    },{
                        placeholder:'请输入取消订单时长(以分钟为单位)',
                        label: "取消订单时长(以分钟为单位)",
                        prop: "autoOrderCancelTime",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入取消订单时长(以分钟为单位)",
                                trigger: "blur"
                            },
                            {
                                validator: testSort,
                                trigger: "blur"
                            }
                        ]

                    },{
                        placeholder:'自动收货(从发货开始算时间)(以天为单位)',
                        label: "自动收货(从发货开始算时间)(以天为单位)",
                        prop: "autoOrderReceiveTime",
                        tip:"自动收货(从发货开始算时间)(以天为单位)",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入自动收货(从发货开始算时间)(以天为单位)",
                                trigger: "blur"
                            },
                            {
                                validator: testSort,
                                trigger: "blur"
                            }
                        ]
                    },{
                        placeholder:'把订单从确认收货变成已完成(以天为单位)',
                        label: "把订单从确认收货变成已完成(以天为单位)",
                        prop: "autoOrderFinishTime",
                        tip:"把订单从确认收货变成已完成(以天为单位)",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "把订单从确认收货变成已完成(以天为单位)",
                                trigger: "blur"
                            },
                            {
                                validator: testSort,
                                trigger: "blur"
                            }
                        ]
                    },{
                        placeholder:'请输入自动审核退款时间(以分钟为单位)',
                        label: "发货前申请退款，商家不审核自动退款(以分钟为单位)",
                        prop: "autoRefundOrderTime",
                        tip:"发货前申请退款，商家不审核自动退款(以分钟为单位)",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入自动审核退款时间(以分钟为单位)",
                                trigger: "blur"
                            },
                            {
                                validator: testSort,
                                trigger: "blur"
                            }
                        ]
                    }]
                },

            };
        },
        created(){
            this.getData()
        },
        methods: {
            getData(){
                getOrder().then(res=>{
                    if(res.data.code==200){
                        this.obj=res.data.data
                    }
                })

            },
            submit(form,done) {
                console.log(this.obj)
                setOrder(this.obj).then(res=>{
                    if(res.data.code==200){
                        this.$message({
                            message:'提交成功',
                            type:'success'
                        })
                        done();
                        this.getData()
                    }
                })

            }
        }
    };
</script>